﻿using System;
using System.Collections.Generic;

namespace FoodBank.Core
{
    [Serializable]
    public class FoodBankException : Exception
    {
        public IDictionary<string, string> Errors { get; private set; }

        public FoodBankException(string propertyName, string errorMessage)
            : base(errorMessage)
        {
            Errors = new Dictionary<string, string> {{propertyName, errorMessage}};
        }

        public FoodBankException(IDictionary<string, string> errors)
        {
            Errors = errors;
        }

        public FoodBankException(string errorMessage)
            : base(errorMessage)
        {
            Errors = new Dictionary<string, string>();
        }

        public FoodBankException(string errorMessage, Exception innerException)
            : base(errorMessage, innerException)
        {
            Errors = new Dictionary<string, string>();
        }
    }
}
